﻿<!--

    This file is a part of BinaryDialog.
 
    BiLog IM aka BinaryDialog - WPF Client for XMPP Protocol
    Copyright (C) 2008  Christophe LEMOINE

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see<http://www.gnu.org/licenses/> .

 -->

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:relations="clr-namespace:BinaryDialog.Core.Relationship"
    xmlns:datas="clr-namespace:BinaryDialog.Datas">
        
    <Style x:Key="{x:Type ListBoxItem}" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border Name="PrimaryBorder" CornerRadius="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
                        <Border Name="SecondaryBorder" CornerRadius="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="Transparent" Background="Transparent">
                            <ContentPresenter />
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="PrimaryBorder" Property="BorderBrush" Value="{StaticResource HoverPrimaryBorderBrush}" />
                            <Setter TargetName="PrimaryBorder" Property="Background" Value="{StaticResource HighOpacityWhiteBrush}" />
                            <Setter TargetName="SecondaryBorder" Property="BorderBrush" Value="{StaticResource HoverSecondaryBorderBrush}" />
                            <Setter TargetName="SecondaryBorder" Property="Background" Value="{StaticResource HoverGradientBrush}" />
                        </Trigger>
                        
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="PrimaryBorder" Property="BorderBrush" Value="{StaticResource SelectedPrimaryBorderBrush}" />
                            <Setter TargetName="PrimaryBorder" Property="Background" Value="{StaticResource HighOpacityWhiteBrush}" />
                            <Setter TargetName="SecondaryBorder" Property="BorderBrush" Value="{StaticResource SelectedSecondaryBorderBrush}" />
                            <Setter TargetName="SecondaryBorder" Property="Background" Value="{StaticResource SelectedGradientBrush}" />
                        </Trigger>
                        
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsFocused" Value="False" />
                                <Condition Property="IsSelected" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PrimaryBorder" Property="BorderBrush" Value="{StaticResource NoFocusPrimaryBorderBrush}" />
                            <Setter TargetName="PrimaryBorder" Property="Background" Value="{StaticResource HighOpacityWhiteBrush}" />
                            <Setter TargetName="SecondaryBorder" Property="BorderBrush" Value="{StaticResource NoFocusSecondaryBorderBrush}" />
                            <Setter TargetName="SecondaryBorder" Property="Background" Value="{StaticResource NoFocusGradientBrush}" />
                        </MultiTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="{x:Type ListBox}" TargetType="{x:Type ListBox}">
        <Setter Property="Background" Value="{StaticResource LowOpacityWhiteBrush}" />
        <Setter Property="IsSynchronizedWithCurrentItem" Value="True" />
    </Style>
    
    <Style x:Key="AccountsList" TargetType="{x:Type ListBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                        <WrapPanel Margin="16,8,16,8" IsItemsHost="True" />
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <DataTemplate.Resources>
                        <relations:AccountsConverter x:Key="AccountsConverter" />
                    </DataTemplate.Resources>
                    <StackPanel Orientation="Vertical" Margin="8" Width="88">
                        <StackPanel.Style>
                            <Style TargetType="{x:Type StackPanel}">
                                <Setter Property="Opacity" Value="{Binding Path=Connected, Mode=OneWay, Converter={StaticResource AccountsConverter}, ConverterParameter=ConnectedOpacity}" />
                            </Style>
                        </StackPanel.Style>
                        <Image Source="{Binding Path=Avatar, Mode=OneWay, Converter={StaticResource AccountsConverter}, ConverterParameter=Avatar}" Width="48" Height="48" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Image.BitmapEffect>
                                <OuterGlowBitmapEffect GlowSize="5" GlowColor="{StaticResource LowOpacityWhiteColor}" />
                            </Image.BitmapEffect>
                        </Image>
                        <TextBlock Text="{Binding Path=NickName}" Margin="0,8,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="12">
                            <TextBlock.Style>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Setter Property="FontStyle" Value="{Binding Path=Connected, Mode=OneWay, Converter={StaticResource AccountsConverter}, ConverterParameter=ConnectedFontStyle}" />
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                        <TextBlock Text="{Binding Path=Server}" Margin="0,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextAlignment="Center" TextTrimming="CharacterEllipsis" FontSize="10">
                            <TextBlock.Style>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Setter Property="FontStyle" Value="{Binding Path=Connected, Mode=OneWay, Converter={StaticResource AccountsConverter}, ConverterParameter=ConnectedFontStyle}" />
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
    </Style>
    
</ResourceDictionary>